3.40 \(\int \frac {\cot (c+d x) (A+B \tan (c+d x))}{a+i a \tan (c+d x)} \, dx\)

Optimal. Leaf size=62 \[ \frac {A+i B}{2 d (a+i a \tan (c+d x))}-\frac {x (-B+i A)}{2 a}+\frac {A \log (\sin (c+d x))}{a d} \]

[Out]

-1/2*(I*A-B)*x/a+A*ln(sin(d*x+c))/a/d+1/2*(A+I*B)/d/(a+I*a*tan(d*x+c))

________________________________________________________________________________________

Rubi [A]  time = 0.11, antiderivative size = 62, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 3, integrand size = 32, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.094, Rules used = {3596, 3531, 3475} \[ \frac {A+i B}{2 d (a+i a \tan (c+d x))}-\frac {x (-B+i A)}{2 a}+\frac {A \log (\sin (c+d x))}{a d} \]

Antiderivative was successfully verified.

[In]

Int[(Cot[c + d*x]*(A + B*Tan[c + d*x]))/(a + I*a*Tan[c + d*x]),x]

[Out]

-((I*A - B)*x)/(2*a) + (A*Log[Sin[c + d*x]])/(a*d) + (A + I*B)/(2*d*(a + I*a*Tan[c + d*x]))

Rule 3475

Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> -Simp[Log[RemoveContent[Cos[c + d*x], x]]/d, x] /; FreeQ[{c, d}, x]

Rule 3531

Int[((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)])/((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[((a*c +
 b*d)*x)/(a^2 + b^2), x] + Dist[(b*c - a*d)/(a^2 + b^2), Int[(b - a*Tan[e + f*x])/(a + b*Tan[e + f*x]), x], x]
 /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 + b^2, 0] && NeQ[a*c + b*d, 0]

Rule 3596

Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((A_.) + (B_.)*tan[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*tan[(e_
.) + (f_.)*(x_)])^(n_), x_Symbol] :> Simp[((a*A + b*B)*(a + b*Tan[e + f*x])^m*(c + d*Tan[e + f*x])^(n + 1))/(2
*f*m*(b*c - a*d)), x] + Dist[1/(2*a*m*(b*c - a*d)), Int[(a + b*Tan[e + f*x])^(m + 1)*(c + d*Tan[e + f*x])^n*Si
mp[A*(b*c*m - a*d*(2*m + n + 1)) + B*(a*c*m - b*d*(n + 1)) + d*(A*b - a*B)*(m + n + 1)*Tan[e + f*x], x], x], x
] /; FreeQ[{a, b, c, d, e, f, A, B, n}, x] && NeQ[b*c - a*d, 0] && EqQ[a^2 + b^2, 0] && LtQ[m, 0] &&  !GtQ[n,
0]

Rubi steps

\begin {align*} \int \frac {\cot (c+d x) (A+B \tan (c+d x))}{a+i a \tan (c+d x)} \, dx &=\frac {A+i B}{2 d (a+i a \tan (c+d x))}+\frac {\int \cot (c+d x) (2 a A-a (i A-B) \tan (c+d x)) \, dx}{2 a^2}\\ &=-\frac {(i A-B) x}{2 a}+\frac {A+i B}{2 d (a+i a \tan (c+d x))}+\frac {A \int \cot (c+d x) \, dx}{a}\\ &=-\frac {(i A-B) x}{2 a}+\frac {A \log (\sin (c+d x))}{a d}+\frac {A+i B}{2 d (a+i a \tan (c+d x))}\\ \end {align*}

________________________________________________________________________________________

Mathematica [B]  time = 1.14, size = 150, normalized size = 2.42 \[ \frac {\cos (c+d x) (A+B \tan (c+d x)) \left (\tan (c+d x) \left (2 A \log \left (\sin ^2(c+d x)\right )+2 i A d x-A+2 B d x-i B\right )-4 i A \tan ^{-1}(\tan (d x)) (\tan (c+d x)-i)-2 i A \log \left (\sin ^2(c+d x)\right )+2 A d x-i A-2 i B d x+B\right )}{4 a d (\tan (c+d x)-i) (A \cos (c+d x)+B \sin (c+d x))} \]

Antiderivative was successfully verified.

[In]

Integrate[(Cot[c + d*x]*(A + B*Tan[c + d*x]))/(a + I*a*Tan[c + d*x]),x]

[Out]

(Cos[c + d*x]*(A + B*Tan[c + d*x])*((-I)*A + B + 2*A*d*x - (2*I)*B*d*x - (2*I)*A*Log[Sin[c + d*x]^2] + (-A - I
*B + (2*I)*A*d*x + 2*B*d*x + 2*A*Log[Sin[c + d*x]^2])*Tan[c + d*x] - (4*I)*A*ArcTan[Tan[d*x]]*(-I + Tan[c + d*
x])))/(4*a*d*(A*Cos[c + d*x] + B*Sin[c + d*x])*(-I + Tan[c + d*x]))

________________________________________________________________________________________

fricas [A]  time = 0.67, size = 65, normalized size = 1.05 \[ \frac {{\left ({\left (-6 i \, A + 2 \, B\right )} d x e^{\left (2 i \, d x + 2 i \, c\right )} + 4 \, A e^{\left (2 i \, d x + 2 i \, c\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} - 1\right ) + A + i \, B\right )} e^{\left (-2 i \, d x - 2 i \, c\right )}}{4 \, a d} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(d*x+c)*(A+B*tan(d*x+c))/(a+I*a*tan(d*x+c)),x, algorithm="fricas")

[Out]

1/4*((-6*I*A + 2*B)*d*x*e^(2*I*d*x + 2*I*c) + 4*A*e^(2*I*d*x + 2*I*c)*log(e^(2*I*d*x + 2*I*c) - 1) + A + I*B)*
e^(-2*I*d*x - 2*I*c)/(a*d)

________________________________________________________________________________________

giac [A]  time = 0.46, size = 99, normalized size = 1.60 \[ -\frac {\frac {{\left (3 \, A + i \, B\right )} \log \left (\tan \left (d x + c\right ) - i\right )}{a} + \frac {{\left (A - i \, B\right )} \log \left (-i \, \tan \left (d x + c\right ) + 1\right )}{a} - \frac {4 \, A \log \left (\tan \left (d x + c\right )\right )}{a} - \frac {3 \, A \tan \left (d x + c\right ) + i \, B \tan \left (d x + c\right ) - 5 i \, A + 3 \, B}{a {\left (\tan \left (d x + c\right ) - i\right )}}}{4 \, d} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(d*x+c)*(A+B*tan(d*x+c))/(a+I*a*tan(d*x+c)),x, algorithm="giac")

[Out]

-1/4*((3*A + I*B)*log(tan(d*x + c) - I)/a + (A - I*B)*log(-I*tan(d*x + c) + 1)/a - 4*A*log(tan(d*x + c))/a - (
3*A*tan(d*x + c) + I*B*tan(d*x + c) - 5*I*A + 3*B)/(a*(tan(d*x + c) - I)))/d

________________________________________________________________________________________

maple [B]  time = 0.77, size = 136, normalized size = 2.19 \[ -\frac {A \ln \left (\tan \left (d x +c \right )+i\right )}{4 d a}+\frac {i B \ln \left (\tan \left (d x +c \right )+i\right )}{4 d a}+\frac {A \ln \left (\tan \left (d x +c \right )\right )}{d a}-\frac {i A}{2 d a \left (\tan \left (d x +c \right )-i\right )}+\frac {B}{2 d a \left (\tan \left (d x +c \right )-i\right )}-\frac {3 \ln \left (\tan \left (d x +c \right )-i\right ) A}{4 d a}-\frac {i \ln \left (\tan \left (d x +c \right )-i\right ) B}{4 d a} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cot(d*x+c)*(A+B*tan(d*x+c))/(a+I*a*tan(d*x+c)),x)

[Out]

-1/4/d/a*A*ln(tan(d*x+c)+I)+1/4*I/d/a*B*ln(tan(d*x+c)+I)+1/d/a*A*ln(tan(d*x+c))-1/2*I/d/a/(tan(d*x+c)-I)*A+1/2
/d/a/(tan(d*x+c)-I)*B-3/4/d/a*ln(tan(d*x+c)-I)*A-1/4*I/d/a*ln(tan(d*x+c)-I)*B

________________________________________________________________________________________

maxima [F(-2)]  time = 0.00, size = 0, normalized size = 0.00 \[ \text {Exception raised: RuntimeError} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(d*x+c)*(A+B*tan(d*x+c))/(a+I*a*tan(d*x+c)),x, algorithm="maxima")

[Out]

Exception raised: RuntimeError >> ECL says: Error executing code in Maxima: expt: undefined: 0 to a negative e
xponent.

________________________________________________________________________________________

mupad [B]  time = 6.26, size = 98, normalized size = 1.58 \[ \frac {\frac {A}{2\,a}+\frac {B\,1{}\mathrm {i}}{2\,a}}{d\,\left (1+\mathrm {tan}\left (c+d\,x\right )\,1{}\mathrm {i}\right )}+\frac {A\,\ln \left (\mathrm {tan}\left (c+d\,x\right )\right )}{a\,d}+\frac {\ln \left (\mathrm {tan}\left (c+d\,x\right )+1{}\mathrm {i}\right )\,\left (B+A\,1{}\mathrm {i}\right )\,1{}\mathrm {i}}{4\,a\,d}-\frac {\ln \left (\mathrm {tan}\left (c+d\,x\right )-\mathrm {i}\right )\,\left (3\,A+B\,1{}\mathrm {i}\right )}{4\,a\,d} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((cot(c + d*x)*(A + B*tan(c + d*x)))/(a + a*tan(c + d*x)*1i),x)

[Out]

(A/(2*a) + (B*1i)/(2*a))/(d*(tan(c + d*x)*1i + 1)) + (A*log(tan(c + d*x)))/(a*d) + (log(tan(c + d*x) + 1i)*(A*
1i + B)*1i)/(4*a*d) - (log(tan(c + d*x) - 1i)*(3*A + B*1i))/(4*a*d)

________________________________________________________________________________________

sympy [A]  time = 0.42, size = 122, normalized size = 1.97 \[ \frac {A \log {\left (e^{2 i d x} - e^{- 2 i c} \right )}}{a d} + \begin {cases} - \frac {\left (- A - i B\right ) e^{- 2 i c} e^{- 2 i d x}}{4 a d} & \text {for}\: 4 a d e^{2 i c} \neq 0 \\x \left (- \frac {- 3 i A + B}{2 a} - \frac {\left (3 i A e^{2 i c} + i A - B e^{2 i c} - B\right ) e^{- 2 i c}}{2 a}\right ) & \text {otherwise} \end {cases} - \frac {x \left (3 i A - B\right )}{2 a} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(d*x+c)*(A+B*tan(d*x+c))/(a+I*a*tan(d*x+c)),x)

[Out]

A*log(exp(2*I*d*x) - exp(-2*I*c))/(a*d) + Piecewise((-(-A - I*B)*exp(-2*I*c)*exp(-2*I*d*x)/(4*a*d), Ne(4*a*d*e
xp(2*I*c), 0)), (x*(-(-3*I*A + B)/(2*a) - (3*I*A*exp(2*I*c) + I*A - B*exp(2*I*c) - B)*exp(-2*I*c)/(2*a)), True
)) - x*(3*I*A - B)/(2*a)

________________________________________________________________________________________